package com.ss.android.newmedia;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Pair;

import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.plugin.interfaces.pushmanager.PushSettingManager;
import com.bytedance.common.plugin.interfaces.pushmanager.client.SsRedbadgeManager;
import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.c.SharedPreferenceCompat;
import com.bytedance.common.utility.collection.WeakHandler;
import com.bytedance.common.utility.collection.WeakHandler.Callback;
import com.bytedance.common.utility.collection.WeakList;
import com.bytedance.frameworks.b.a.ComponentsManifest;
import com.ss.android.common.AppContext;
import com.ss.android.common.app.AbsActivity;
import com.ss.android.common.app.AbsApplication;
import com.ss.android.common.app.AppHooks;
import com.ss.android.common.app.WebViewTweaker;
import com.ss.android.common.app.AppHooks.ActivityResultHook;
import com.ss.android.common.applog.AppLog;
import com.ss.android.common.applog.CustomChannelHandler;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.common.util.MultiProcessSharedProvider;
import com.ss.android.common.util.NetworkUtils;
import com.ss.android.common.util.IdCache;
import com.ss.android.d.SSDBHelper;
import com.ss.android.messagebus.SubscriptionRouter;
import com.ss.android.model.f;
import com.ss.android.model.AbsArticle;
import com.ss.android.newmedia.a.InputMethodManagerUtil;

import org.json.JSONArray;
import org.json.JSONObject;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;

import inline.FileUtils;

public abstract class MediaAppData implements Callback, com.ss.android.cc, AppHooks.ActivityLifeCycleHook, ActivityResultHook, AppHooks.AppStartMonitorHook, com.ss.android.common.applog.AppLog.e {
    public final class h$a {
        public h$a() {

        }
    }

    public interface h$b {
        void e();
    }

    private long mSendBrowserInfoInterval;
    private long mLastSendBroserInfoTime;
    private boolean mLastSendBrowserInfoSuccess;
    private String mLastSendBrowserInfoMD5;
    private int mAllowBrowserInfo = 0;
    private boolean mHasAgreeProtocol = false;
    private int mAllowUmsocial = 1;
    private int mAllowInsideDownloadManager = 1;
    private int mAllowLauncherAds = 1;
    private int mFixImmMemoryLeak = -1;
    private int mTaoBaoSdkDisable = 1;
    private String mTaobaoSdkTags = "";
    private long taobaoSdkRefreshInterval = 21600;
    private long firstLocalActivateTime;
    private int mUseWeiboSdk = 1;
    private boolean mHasSetGetuiAlias = false;
    private int mShowVideoSeekBar = 1;
    private int mVideoDiagnosisFlag = 1;
    private boolean mPluginAvailableFlag = true;
    private int mLocationGaodeAsyncSwitch = 1;
    private String mDownloadWhiteListFileUrl;
    private String mDownloadWhiteListFileMD5;
    private String mDownloadWhiteListFileStr;
    private long mDownloadWhiteListFileTime;
    private int mNotifyPlatformExpiredPeriod = 5;
    private int mHijackInterceptEnable = 1;
    private com.ss.android.newmedia.j.c.c$a a;
    private long mHijackInterceptRefreshInterval = 43200;
    private String mLitePluginCheckUrl = "";
    private volatile int mAppLogReciverySwitch;
    private volatile int b;
    private SharedPreferences mAppSettingSp;
    public volatile int cA;
    public static MediaAppData instance;
    public final AppContext appContext;
    public final int cD;
    public final Context mContext;
    public WeakReference cF;
    public long cG = 0;
    public long cH = 0;
    public volatile long cI = 0;
    public volatile long cJ = 0;
    public boolean cK = false;
    public boolean cL = false;
    protected static boolean cM = false;
    protected static boolean cN = false;
    protected static boolean cO = false;
    protected static boolean cP = false;
    protected static boolean cQ = true;
    public final Set cR = new HashSet();
    public IdCache mNotifyMessage = new IdCache(10);
    public WeakList cT = new WeakList();
    public List downloadWhiteList = new ArrayList();
    public boolean mDefaultSettingLoaded = false;
    public int mKeepNotifyCount = 0;
    public int mMaxNotifyCount = 0;
    public int mNotifyRefreshPeriod = 0;
    public int mForceJSPermission = -1;
    private Object d = new Object();
    public WeakHandler mWeakHandler = new WeakHandler(Looper.getMainLooper(), ((Callback) this));
    public boolean mAllowHtmlVideo = true;
    protected int mUnifyApiUserAgent = -1;
    public long mClearCacheTime = 0;
    protected int lastHintVersioni;
    protected int hintVersionDelayDays;
    protected long lastHintTime;
    public int lastVersionCode = 0;
    public boolean dh;
    protected int predownloadVersion;
    protected long preDownloadStartTime;
    protected int preDownloadDelayDays;
    protected long preDownloadDelaySecond;
    public boolean mShareWhenFavor = false;
    public boolean mShareWhenFavorShowed = false;
    public long mSendInstallAppsInterval;
    public long mSendRecentAppsInterval;
    public long mWapLoadTimeLimitWifi = -1;
    public long wapLoadTimeLimitMobile = -1;
    public int mVideoStatisticsFlag = 0;
    public int mVideoPlayRetryInterval = 15;
    public int mVideoPlayRetryPolicy = 1;
    public int mMonitorImageFrescoSwitch = 1;
    public String mLastLoginMobile = "";
    public String mMobileRegexAndroid = "[[\'^(\\\\+86)?(1\\\\d{10})$\', \'$2\']]";
    public int mAccessedContactConfirmed = 1;
    String mAdTrackUrlList;
    private boolean e = false;
    private static boolean f = false;
    private static int allowNetwork = -1;
    private JSONObject h = new JSONObject();
    private boolean i = false;
    private long j = 0;
    private long k = 0;
    private List l = new ArrayList();
    private boolean m = false;
    private List n = new ArrayList();
    private String mInterceptUrls = "";
    private String downloadWhiteListString = "";
    private int mForceNoHwAcceleration = 0;
    private int mTweakWebViewBug = -1;
    private int mTweakWebViewDeviceMotion = -1;
    private int mTweakWebViewDrawingCache = -1;
    private String mRecommend = "";
    private long mSocialAddFriendTime;
    private boolean mAppShorcutShowed = false;
    private String mShareTempletes = "";
    private boolean mReportSendHtml = true;
    private boolean mCloseActivePushAlert;

    public MediaAppData(AppContext arg11) {
        int v0 = 1;
        this.appContext = arg11;
        if (this.appContext != null) {
            v0 = this.appContext.getVersionCode();
        }

        this.cD = v0;
        this.mContext = this.appContext != null ? this.appContext.getContext() : null;
        ComponentsManifest.addComponent(com.ss.android.cc.class, this);
    }

    public boolean K() {
        return this.mAppLogReciverySwitch == 0;
    }

    public static long getLong(JSONObject jo, String key) {
        return jo.optLong(key, -1);
    }

    public static IdCache.Id a(long arg2, long arg4) {
        IdCache.Id v0 = new IdCache.Id();
        v0.id = Long.valueOf(arg2);
        v0.time = arg4;
        return v0;
    }

    private static void parseJA(JSONArray arg4, List arg5) {
        if (arg4 != null) {
            int v1 = arg4.length();
            int v0;
            for (v0 = 0; v0 < v1; ++v0) {
                String v2 = arg4.optString(v0);
                if (v2 != null && v2.length() > 0) {
                    arg5.add(v2);
                }
            }
        }
    }

    public static void a(boolean arg1, boolean arg2) {
        cM = false;
        f = arg1;
        cN = false;
        cO = false;
        cP = false;
        cQ = arg2;
    }

    public final JSONObject a() {
        JSONObject v0 = this.a != null ? this.a.c : null;
        return v0;
    }

    public void a(Context arg2) {
        this.getAppContext().getAppName();
        MobClickCombiner.init(arg2);
        AppLog.a(arg2);
    }

    public void a(SharedPreferences.Editor editor) {
        editor.putBoolean("default_setting_loaded", this.mDefaultSettingLoaded);
        editor.putInt("keep_notify_count", this.mKeepNotifyCount);
        editor.putInt("max_notify_count", this.mMaxNotifyCount);
        editor.putInt("notify_fresh_period", this.mNotifyRefreshPeriod);
        editor.putString("intercept_urls", this.mInterceptUrls);
        editor.putInt("force_js_permission", this.mForceJSPermission);
        editor.putBoolean("allow_html_video", this.mAllowHtmlVideo);
        editor.putInt("force_no_hw_acceleration", this.mForceNoHwAcceleration);
        editor.putInt("tweak_webview_bug", this.mTweakWebViewBug);
        editor.putInt("tweak_webview_devicemotion", this.mTweakWebViewDeviceMotion);
        editor.putInt("tweak_webview_drawing_cache", this.mTweakWebViewDrawingCache);
        editor.putInt("unify_api_useragent", this.mUnifyApiUserAgent);
        editor.putLong("clear_cache_time", this.mClearCacheTime);
        editor.putString("recommend", this.mRecommend);
        editor.putInt("last_version_code", this.appContext.getVersionCode());
        editor.putBoolean("share_when_favor", this.mShareWhenFavor);
        editor.putBoolean("share_when_favor_showed", this.mShareWhenFavorShowed);
        editor.putLong("social_add_friend_time", this.mSocialAddFriendTime);
        editor.putBoolean("night_mode_toggled", com.ss.android.j.b.isNightModeToggled());
        editor.putBoolean("app_shortcut_showed", this.mAppShorcutShowed);
        editor.putBoolean("report_send_html", this.mReportSendHtml);
        editor.putString("share_templates", this.mShareTempletes);
        editor.putBoolean("close_active_push_alert", this.mCloseActivePushAlert);
        editor.putLong("send_install_apps_interval", this.mSendInstallAppsInterval);
        editor.putLong("send_recent_apps_interval", this.mSendRecentAppsInterval);
        editor.putLong("send_browser_info_interval", this.mSendBrowserInfoInterval);
        editor.putLong("last_send_browser_info_Time", this.mLastSendBroserInfoTime);
        editor.putBoolean("last_send_browser_info_success", this.mLastSendBrowserInfoSuccess);
        editor.putString("last_send_browser_info_md5", this.mLastSendBrowserInfoMD5);
        editor.putInt("allow_browser_info", this.mAllowBrowserInfo);
        editor.putInt("allow_inside_download_manager", this.mAllowInsideDownloadManager);
        editor.putInt("allow_launcher_ads", this.mAllowLauncherAds);
        editor.putInt("fix_imm_memory_leak", this.mFixImmMemoryLeak);
        editor.putBoolean("has_agree_protocol", this.mHasAgreeProtocol);
        editor.putInt("allow_umsocial", this.mAllowUmsocial);
        editor.putString("notify_message_ids", this.mNotifyMessage.saveIds());
        editor.putString("taobao_sdk_tags", this.mTaobaoSdkTags);
        editor.putLong("taobao_sdk_refresh_interval", this.taobaoSdkRefreshInterval);
        editor.putInt("hijack_intercept_enable", this.mHijackInterceptEnable);
        editor.putLong("hijack_intercept_refresh_interval", this.mHijackInterceptRefreshInterval);
        editor.putLong("wap_load_time_limit_wifi", this.mWapLoadTimeLimitWifi);
        editor.putLong("wap_load_time_limit_mobile", this.wapLoadTimeLimitMobile);
        editor.putLong("first_local_activate_time", this.firstLocalActivateTime);
        editor.putInt("use_weibo_sdk", this.mUseWeiboSdk);
        editor.putBoolean("has_set_getui_alias", this.mHasSetGetuiAlias);
        editor.putInt("video_statistics_flag", this.mVideoStatisticsFlag);
        editor.putInt("video_diagnosis_flag", this.mVideoDiagnosisFlag);
        editor.putBoolean("plugin_available_flag", this.mPluginAvailableFlag);
        editor.putInt("video_play_retry_interval", this.mVideoPlayRetryInterval);
        editor.putInt("video_play_retry_policy", this.mVideoPlayRetryPolicy);
        editor.putInt("show_video_seekbar", this.mShowVideoSeekBar);
        editor.putString("download_white_list_file_url", this.mDownloadWhiteListFileUrl);
        if (!android.support.design.a.isTextEmpty(this.mDownloadWhiteListFileStr)) {
            editor.putString("download_white_list_file_md5", this.mDownloadWhiteListFileMD5);
        }

        editor.putString("download_white_list_file_str", this.mDownloadWhiteListFileStr);
        editor.putLong("download_white_list_file_time", this.mDownloadWhiteListFileTime);
        editor.putString("last_login_mobile", this.mLastLoginMobile);
        editor.putString("mobile_regex_android", this.mMobileRegexAndroid);
        editor.putInt("accessed_contact_confirmed", this.mAccessedContactConfirmed);
        editor.putInt("notify_platform_expired_period", this.mNotifyPlatformExpiredPeriod);
        editor.putString("ad_track_url_list", this.mAdTrackUrlList);
        editor.putInt("monitor_image_fresco_SWITCH", this.mMonitorImageFrescoSwitch);
        editor.putInt("location_gaode_asynchronous_switch", this.mLocationGaodeAsyncSwitch);
        editor.putString("lite_plugin_check_url", this.mLitePluginCheckUrl);
        editor.putInt("applog_recovery_switch", this.mAppLogReciverySwitch);
        Object v0 = com.bytedance.frameworks.b.a.a.b(com.ss.android.bb.class);
        if (v0 != null) {
            ((com.ss.android.bb) v0).a(editor);
        }
    }

    public void a(SharedPreferences sp) {
        long v10 = -1;
        int v6 = -1;
        long v8 = 0;
        this.mDefaultSettingLoaded = sp.getBoolean("default_setting_loaded", false);
        this.mKeepNotifyCount = sp.getInt("keep_notify_count", 0);
        this.mMaxNotifyCount = sp.getInt("max_notify_count", 0);
        this.mNotifyRefreshPeriod = sp.getInt("notify_fresh_period", 0);
        this.mInterceptUrls = sp.getString("intercept_urls", "");
        if (this.mInterceptUrls == null) {
            this.mInterceptUrls = "";
        }

        try {
            this.l.clear();
            if (this.mInterceptUrls.length() <= 0) {
//                goto label_35;
            } else {
                MediaAppData.parseJA(new JSONArray(this.mInterceptUrls), this.l);
            }
        } catch (Exception v0) {
        }

        label_35:
        this.downloadWhiteListString = sp.getString("download_white_list", "");
        if (this.downloadWhiteListString == null) {
            this.downloadWhiteListString = "";
        }

        try {
            this.downloadWhiteList.clear();
            if (this.downloadWhiteListString.length() <= 0) {
//                goto label_53;
            } else {
                MediaAppData.parseJA(new JSONArray(this.downloadWhiteListString), this.downloadWhiteList);
            }
        } catch (Exception v0) {
        }

        label_53:
        this.mForceJSPermission = sp.getInt("force_js_permission", v6);
        this.mAllowHtmlVideo = sp.getBoolean("allow_html_video", true);
        this.mForceNoHwAcceleration = sp.getInt("force_no_hw_acceleration", 0);
        this.mTweakWebViewBug = sp.getInt("tweak_webview_bug", v6);
        WebViewTweaker.a();
        this.mTweakWebViewDeviceMotion = sp.getInt("tweak_webview_devicemotion", v6);
        WebViewTweaker.a(this.mTweakWebViewDeviceMotion);
        this.mTweakWebViewDrawingCache = sp.getInt("tweak_webview_drawing_cache", v6);
        WebViewTweaker.setTweakWebviewDrawingCache(this.mTweakWebViewDrawingCache);
        this.mUnifyApiUserAgent = sp.getInt("unify_api_useragent", v6);
        this.mClearCacheTime = sp.getLong("clear_cache_time", this.mClearCacheTime);
        this.mRecommend = sp.getString("recommend", "");
        sp.getBoolean("slide_hint_showed", false);
        this.mSocialAddFriendTime = sp.getLong("social_add_friend_time", v8);
        this.lastHintVersioni = sp.getInt("last_hint_version", 0);
        this.hintVersionDelayDays = sp.getInt("hint_version_delay_days", 1);
        if (this.hintVersionDelayDays <= 0) {
            this.hintVersionDelayDays = 1;
        } else if (this.hintVersionDelayDays > 16) {
            this.hintVersionDelayDays = 16;
        }

        this.lastHintTime = sp.getLong("last_hint_time", v8);
        this.lastVersionCode = sp.getInt("last_version_code", 0);
        this.dh = true;
        this.predownloadVersion = sp.getInt("pre_download_version", 0);
        this.preDownloadStartTime = sp.getLong("pre_download_start_time", v8);
        this.preDownloadDelayDays = sp.getInt("pre_download_delay_days", 0);
        this.preDownloadDelaySecond = sp.getLong("pre_download_delay_second", v10);
        this.mShareWhenFavor = sp.getBoolean("share_when_favor", false);
        this.mShareWhenFavorShowed = sp.getBoolean("share_when_favor_showed", false);
        sp.getBoolean("night_mode_toggled", false);
        com.ss.android.j.b.a();
        this.mAppShorcutShowed = sp.getBoolean("app_shortcut_showed", false);
        sp.getBoolean("show_recommand_tab", false);
        this.mShareTempletes = sp.getString("share_templates", this.ac());
        this.mReportSendHtml = sp.getBoolean(" report_send_html", true);
        sp.getLong("last_sign_time", v8);
        this.mCloseActivePushAlert = sp.getBoolean("close_active_push_alert", false);
        this.mSendInstallAppsInterval = sp.getLong("send_install_apps_interval", v8);
        this.mSendRecentAppsInterval = sp.getLong("send_recent_apps_interval", v8);
        this.mSendBrowserInfoInterval = sp.getLong("send_browser_info_interval", 10000);
        this.mLastSendBroserInfoTime = sp.getLong("last_send_browser_info_Time", v8);
        this.mLastSendBrowserInfoSuccess = sp.getBoolean("last_send_browser_info_success", false);
        this.mLastSendBrowserInfoMD5 = sp.getString("last_send_browser_info_md5", "");
        this.mAllowBrowserInfo = sp.getInt("allow_browser_info", 0);
        this.mHasAgreeProtocol = sp.getBoolean("has_agree_protocol", false);
        this.mAllowUmsocial = sp.getInt("allow_umsocial", 1);
        this.mAllowInsideDownloadManager = sp.getInt("allow_inside_download_manager", 1);
        this.mAllowLauncherAds = sp.getInt("allow_launcher_ads", 1);
        this.mFixImmMemoryLeak = sp.getInt("fix_imm_memory_leak", v6);
        boolean v0_1 = this.mFixImmMemoryLeak != 0 ? true : false;
        InputMethodManagerUtil.a(v0_1);
        this.mNotifyMessage.loadIds(sp.getString("notify_message_ids", ""));
        this.mTaobaoSdkTags = sp.getString("taobao_sdk_tags", "");
        this.taobaoSdkRefreshInterval = sp.getLong("taobao_sdk_refresh_interval", 21600);
        this.mHijackInterceptEnable = sp.getInt("hijack_intercept_enable", 1);
        this.mHijackInterceptRefreshInterval = sp.getLong("hijack_intercept_refresh_interval", 43200);
        this.mWapLoadTimeLimitWifi = sp.getLong("wap_load_time_limit_wifi", v10);
        this.wapLoadTimeLimitMobile = sp.getLong("wap_load_time_limit_mobile", v10);
        this.firstLocalActivateTime = sp.getLong("first_local_activate_time", v10);
        long v4 = System.currentTimeMillis();
        if (this.firstLocalActivateTime < v8 || this.firstLocalActivateTime > v4) {
            this.firstLocalActivateTime = v4;
            this.cL = true;
        }

        this.mUseWeiboSdk = sp.getInt("use_weibo_sdk", 1);
        this.mHasSetGetuiAlias = sp.getBoolean("has_set_getui_alias", false);
        this.mVideoStatisticsFlag = sp.getInt("video_statistics_flag", 0);
        this.mVideoDiagnosisFlag = sp.getInt("video_diagnosis_flag", 1);
        this.mPluginAvailableFlag = sp.getBoolean("plugin_available_flag", true);
        this.mVideoPlayRetryInterval = sp.getInt("video_play_retry_interval", 15);
        this.mVideoPlayRetryPolicy = sp.getInt("video_play_retry_policy", 1);
        this.mShowVideoSeekBar = sp.getInt("show_video_seekbar", 1);
        this.mDownloadWhiteListFileUrl = sp.getString("download_white_list_file_url", "");
        this.mDownloadWhiteListFileMD5 = sp.getString("download_white_list_file_md5", "");
        this.mDownloadWhiteListFileStr = sp.getString("download_white_list_file_str", "");
        this.mDownloadWhiteListFileTime = sp.getLong("download_white_list_file_time", v8);
        this.mLastLoginMobile = sp.getString("last_login_mobile", "");
        this.mMobileRegexAndroid = sp.getString("mobile_regex_android", "[[\'^(\\\\+86)?(1\\\\d{10})$\', \'$2\']]");
        this.mAccessedContactConfirmed = sp.getInt("accessed_contact_confirmed", 1);
        this.mNotifyPlatformExpiredPeriod = sp.getInt("notify_platform_expired_period", 5);
        this.mAdTrackUrlList = sp.getString("ad_track_url_list", "");
        this.mLitePluginCheckUrl = sp.getString("lite_plugin_check_url", "");
        this.mAppLogReciverySwitch = sp.getInt("applog_recovery_switch", 0);
        Object v0_2 = com.bytedance.frameworks.b.a.a.b(com.ss.android.bb.class);
        if (v0_2 != null) {
            ((com.ss.android.bb) v0_2).a(sp);
        }

        this.f();
    }

    public final void a(f arg2) {
        SSDBHelper v0 = this.getDBHelper();
        if (v0 != null) {
            v0.a(arg2);
        }
    }

    public void a(AbsArticle arg1) {
    }

    public final void a(String arg5, int arg6) {
        try {
            this.h.put(arg5, arg6);
        } catch (Exception v0) {
            Logger.w("MediaAppData", "addSettingItem exception: " + v0);
        }
    }

    public abstract boolean a(Activity arg1);

    public boolean onActivityResult(Activity activity, int arg3, int arg4, Intent intent) {
        return false;
    }

    public boolean a(String arg2) {
        return !this.mCloseActivePushAlert;
    }

    public boolean a(JSONObject jo) {
        String taoBaoSdkTags;
        JSONArray v4_2;
        boolean v0_1;
        long v6 = 10000;
        long v12 = 0;
        int v10 = -1;
        int allowUmsocial = jo.optInt("allow_umsocial", v10);
        if (allowUmsocial < 0 || allowUmsocial == this.mAllowUmsocial) {
            v0_1 = false;
        } else {
            this.mAllowUmsocial = allowUmsocial;
            v0_1 = true;
        }

        int taobaoSdkDisable = jo.optInt("allow_umsocial", v10);
        if (taobaoSdkDisable >= 0 && taobaoSdkDisable != this.mAllowUmsocial) {
            this.mAllowUmsocial = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("allow_inside_download_manager", v10);
        if (taobaoSdkDisable > 0 && taobaoSdkDisable != this.mAllowInsideDownloadManager) {
            this.mAllowInsideDownloadManager = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("allow_launcher_ads", v10);
        if (taobaoSdkDisable > 0 && taobaoSdkDisable != this.mAllowLauncherAds) {
            this.mAllowLauncherAds = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("fix_imm_memory_leak", v10);
        if (taobaoSdkDisable != this.mFixImmMemoryLeak) {
            this.mFixImmMemoryLeak = taobaoSdkDisable;
            v0_1 = this.mFixImmMemoryLeak != 0 ? true : false;
            InputMethodManagerUtil.a(v0_1);
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("max_notify_count", v10);
        if (taobaoSdkDisable > 0 && taobaoSdkDisable != this.mMaxNotifyCount) {
            this.mMaxNotifyCount = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("notify_fresh_period", v10);
        if (taobaoSdkDisable > 0 && taobaoSdkDisable != this.mNotifyRefreshPeriod) {
            this.mNotifyRefreshPeriod = taobaoSdkDisable;
            v0_1 = true;
        }

        int v4 = jo.optInt(" report_send_html", v10);
        boolean v3_1 = v4 > 0 ? true : false;
        if (v4 >= 0 && v3_1 != this.mReportSendHtml) {
            this.mReportSendHtml = v3_1;
            v0_1 = true;
        }

        v4 = jo.optInt("close_active_push_alert", v10);
        v3_1 = v4 > 0 ? true : false;
        if (v4 >= 0 && v3_1 != this.mCloseActivePushAlert) {
            this.mCloseActivePushAlert = v3_1;
            v0_1 = true;
        }

        long mTaobaoSdkRefreshInterval = MediaAppData.getLong(jo, "send_install_apps_interval");
        if (mTaobaoSdkRefreshInterval >= v12 && mTaobaoSdkRefreshInterval != this.mSendInstallAppsInterval) {
            this.mSendInstallAppsInterval = mTaobaoSdkRefreshInterval;
            v0_1 = true;
        }

        mTaobaoSdkRefreshInterval = MediaAppData.getLong(jo, "send_recent_apps_interval");
        if (mTaobaoSdkRefreshInterval >= v12 && mTaobaoSdkRefreshInterval != this.mSendRecentAppsInterval) {
            this.mSendRecentAppsInterval = mTaobaoSdkRefreshInterval;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("use_weibo_sdk", v10);
        if (taobaoSdkDisable != this.mUseWeiboSdk && taobaoSdkDisable >= 0) {
            this.mUseWeiboSdk = taobaoSdkDisable;
            v0_1 = true;
        }

        mTaobaoSdkRefreshInterval = MediaAppData.getLong(jo, "send_browser_info_interval");
        if (mTaobaoSdkRefreshInterval != this.mSendBrowserInfoInterval) {
            if (mTaobaoSdkRefreshInterval <= v6) {
                mTaobaoSdkRefreshInterval = v6;
            }

            this.mSendBrowserInfoInterval = mTaobaoSdkRefreshInterval;
            v0_1 = true;
        }

        try {
            v4_2 = jo.optJSONArray("intercept_urls");
            taoBaoSdkTags = "";
            if (v4_2 != null) {
                taoBaoSdkTags = v4_2.toString();
            }

            if (taoBaoSdkTags.equals(this.mInterceptUrls)) {
//                goto label_117;
            } else {
                try {
                    this.l.clear();
                    this.mInterceptUrls = taoBaoSdkTags;
                    MediaAppData.parseJA(v4_2, this.l);
                    v0_1 = true;
                } catch (Exception v0_2) {
                    v0_1 = true;
                }
            }
        } catch (Exception v3_2) {
//            goto label_117;
        }

        try {
            label_117:
            v4_2 = jo.optJSONArray("download_white_list");
            taoBaoSdkTags = "";
            if (v4_2 != null) {
                taoBaoSdkTags = v4_2.toString();
            }

            if (taoBaoSdkTags.equals(this.downloadWhiteListString)) {
//                goto label_131;
            } else {
                try {
                    this.downloadWhiteList.clear();
                    this.downloadWhiteListString = taoBaoSdkTags;
                    MediaAppData.parseJA(v4_2, this.downloadWhiteList);
                    v0_1 = true;
                } catch (Exception v0_2) {
                    v0_1 = true;
                }
            }
        } catch (Exception v3_2) {
//            goto label_131;
        }


        label_131:
        taobaoSdkDisable = jo.optInt("force_js_permission", v10);
        if (taobaoSdkDisable != this.mForceJSPermission) {
            this.mForceJSPermission = taobaoSdkDisable;
            v0_1 = true;
        }

        v3_1 = jo.optInt("allow_html_video", v10) != 0 ? true : false;
        if (v3_1 != this.mAllowHtmlVideo) {
            this.mAllowHtmlVideo = v3_1;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("force_no_hw_acceleration");
        if (taobaoSdkDisable != this.mForceNoHwAcceleration) {
            this.mForceNoHwAcceleration = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("tweak_webview_bug", v10);
        if (taobaoSdkDisable != this.mTweakWebViewBug) {
            this.mTweakWebViewBug = taobaoSdkDisable;
            v0_1 = true;
            WebViewTweaker.a();
        }

        taobaoSdkDisable = jo.optInt("tweak_webview_devicemotion", v10);
        if (taobaoSdkDisable != this.mTweakWebViewDeviceMotion) {
            this.mTweakWebViewDeviceMotion = taobaoSdkDisable;
            WebViewTweaker.a(taobaoSdkDisable);
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("tweak_webview_drawing_cache", v10);
        if (taobaoSdkDisable != this.mTweakWebViewDrawingCache) {
            this.mTweakWebViewDrawingCache = taobaoSdkDisable;
            WebViewTweaker.setTweakWebviewDrawingCache(taobaoSdkDisable);
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("video_statistics_flag", v10);
        if (taobaoSdkDisable != this.mVideoStatisticsFlag) {
            this.mVideoStatisticsFlag = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("video_diagnosis_flag", v10);
        if (taobaoSdkDisable >= 0 && taobaoSdkDisable != this.mVideoDiagnosisFlag) {
            this.mVideoDiagnosisFlag = taobaoSdkDisable;
            v0_1 = true;
        }

        v3_1 = jo.optBoolean("plugin_available_flag", true);
        if (v3_1 != this.mPluginAvailableFlag) {
            this.mPluginAvailableFlag = v3_1;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("video_play_retry_interval", v10);
        if (taobaoSdkDisable != this.mVideoPlayRetryInterval) {
            this.mVideoPlayRetryInterval = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("video_play_retry_policy", v10);
        if (taobaoSdkDisable != this.mVideoPlayRetryPolicy) {
            this.mVideoPlayRetryPolicy = taobaoSdkDisable;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("show_video_seekbar", v10);
        if (taobaoSdkDisable != this.mShowVideoSeekBar) {
            this.mShowVideoSeekBar = taobaoSdkDisable;
            v0_1 = true;
        }

        taoBaoSdkTags = jo.optString("download_white_list_file_url");
        if (!android.support.design.a.isTextEquals(taoBaoSdkTags, this.mDownloadWhiteListFileUrl)) {
            this.mDownloadWhiteListFileUrl = taoBaoSdkTags;
            v0_1 = true;
        }

        taoBaoSdkTags = jo.optString("download_white_list_file_md5");
        mTaobaoSdkRefreshInterval = System.currentTimeMillis();
        if (!android.support.design.a.isTextEquals(taoBaoSdkTags, this.mDownloadWhiteListFileMD5) && mTaobaoSdkRefreshInterval - this.mDownloadWhiteListFileTime > 86400000) {
            this.mDownloadWhiteListFileMD5 = taoBaoSdkTags;
            if (!this.m || !android.support.design.a.isTextEmpty(this.mDownloadWhiteListFileUrl)) {
                this.m = true;
                new com.ss.android.newmedia.j.d(this.mContext, this.mWeakHandler, this.mDownloadWhiteListFileUrl).start();
            }

            v0_1 = true;
        }

        taoBaoSdkTags = jo.optString("share_templates");
        if (taoBaoSdkTags == null) {
            taoBaoSdkTags = "";
        }

        if (!taoBaoSdkTags.equals(this.mShareTempletes)) {
            this.mShareTempletes = taoBaoSdkTags;
            v0_1 = true;
        }

        taobaoSdkDisable = jo.optInt("taobao_sdk_disable");
        if (Logger.debug()) {
            Logger.d("TaoBao", "get mTaoBaoSdkDisable = " + taobaoSdkDisable);
        }

        if (taobaoSdkDisable != this.mTaoBaoSdkDisable) {
            this.mTaoBaoSdkDisable = taobaoSdkDisable;
            v0_1 = true;
        }

        taoBaoSdkTags = jo.optString("taobao_sdk_tags", "");
        if (Logger.debug()) {
            Logger.d("TaoBao", "get mTaoBaoSdkTags = " + taoBaoSdkTags);
        }

        if (taoBaoSdkTags != null && !taoBaoSdkTags.equals(this.mTaobaoSdkTags)) {
            this.mTaobaoSdkTags = taoBaoSdkTags;
            v0_1 = true;
        }

        mTaobaoSdkRefreshInterval = jo.optLong("taobao_sdk_refresh_interval");
        if (Logger.debug()) {
            Logger.d("TaoBao", "get mTaoBaoRefreshInterval = " + mTaobaoSdkRefreshInterval);
        }

        if (mTaobaoSdkRefreshInterval != this.taobaoSdkRefreshInterval) {
            this.taobaoSdkRefreshInterval = mTaobaoSdkRefreshInterval;
            v0_1 = true;
        }

        int hijackInterceptEnable = jo.optInt("hijack_intercept_enable", 1);
        if (hijackInterceptEnable != this.mHijackInterceptEnable) {
            this.mHijackInterceptEnable = hijackInterceptEnable;
            v0_1 = true;
        }

        long hijackInterceptRefreshInterval = jo.optLong("hijack_intercept_refresh_interval", 43200);
        if (hijackInterceptRefreshInterval != this.mHijackInterceptRefreshInterval) {
            this.mHijackInterceptRefreshInterval = hijackInterceptRefreshInterval;
            v0_1 = true;
        }

        long wapLoadTimeLimitWifi = MediaAppData.getLong(jo, "wap_load_time_limit_wifi");
        if (wapLoadTimeLimitWifi != this.mWapLoadTimeLimitWifi) {
            this.mWapLoadTimeLimitWifi = wapLoadTimeLimitWifi;
            v0_1 = true;
        }

        wapLoadTimeLimitWifi = MediaAppData.getLong(jo, "wap_load_time_limit_mobile");
        if (wapLoadTimeLimitWifi != this.wapLoadTimeLimitMobile) {
            this.wapLoadTimeLimitMobile = wapLoadTimeLimitWifi;
            v0_1 = true;
        }

        taoBaoSdkTags = jo.optString("mobile_regex_android");
        if (!android.support.design.a.isTextEquals(taoBaoSdkTags, this.mMobileRegexAndroid) && !android.support.design.a.isTextEmpty(taoBaoSdkTags)) {
            this.mMobileRegexAndroid = taoBaoSdkTags;
            v0_1 = true;
        }

        hijackInterceptEnable = jo.optInt("notify_platform_expired_period", v10);
        if (hijackInterceptEnable >= 0 && hijackInterceptEnable != this.mNotifyPlatformExpiredPeriod) {
            this.mNotifyPlatformExpiredPeriod = hijackInterceptEnable;
            v0_1 = true;
        }

        hijackInterceptEnable = jo.optInt("monitor_image_fresco_SWITCH", v10);
        if (hijackInterceptEnable >= 0 && hijackInterceptEnable != this.mMonitorImageFrescoSwitch) {
            this.mMonitorImageFrescoSwitch = hijackInterceptEnable;
            v0_1 = true;
        }

        hijackInterceptEnable = jo.optInt("location_gaode_asynchronous_switch", v10);
        if (hijackInterceptEnable >= 0 && hijackInterceptEnable != this.mLocationGaodeAsyncSwitch) {
            this.mLocationGaodeAsyncSwitch = hijackInterceptEnable;
            v0_1 = true;
        }

        this.cA = jo.optInt("retry_html_load_switch_android", 1);
        jo.optInt("report_html_traffic", 0);
        taoBaoSdkTags = jo.optString("lite_plugin_check_url", "");
        if (!android.support.design.a.isTextEmpty(taoBaoSdkTags) && !taoBaoSdkTags.equals(this.mLitePluginCheckUrl)) {
            this.mLitePluginCheckUrl = taoBaoSdkTags;
            try {
                com.ss.android.common.util.MultiProcessSharedProvider.a v4_3 = new com.ss.android.common.util.MultiProcessSharedProvider.a(MultiProcessSharedProvider.getMultiProcessSharedPreference(this.mContext).mContext, (byte) 0);
                v4_3.a("lite_plugin_check_url", this.mLitePluginCheckUrl);
                v4_3.a();
            } catch (Throwable v3_4) {
                v3_4.printStackTrace();
            }
        }

        int v2 = jo.optInt("applog_recovery_switch", 0);
        if (v2 >= 0 && v2 != this.mAppLogReciverySwitch) {
            this.mAppLogReciverySwitch = v2;
            v0_1 = true;
        }

        Iterator v3_5 = com.bytedance.frameworks.b.a.a.a(com.ss.android.bb.class).iterator();
        boolean v2_1;
        for (v2_1 = v0_1; v3_5.hasNext(); v2_1 = v0_1) {
            v0_1 = ((com.ss.android.bb) v3_5.next()).a(jo) ? true : v2_1;
        }

        this.b = jo.optInt("android_hotfix_switch", 1);
        return v2_1;
    }

    public boolean a(JSONObject arg5, boolean arg6) {
        boolean v1 = false;
        boolean v0 = true;
        if (arg6) {
            int v2 = arg5.optInt("repost_favor", -1);
            if ((this.mShareWhenFavor) || v2 != 1) {
                v0 = false;
            } else {
                this.mShareWhenFavor = true;
            }

            com.bytedance.frameworks.b.a.a.b(com.ss.android.bb.class);
            v1 = v0;
        }

        return v1;
    }

    public final void aA() {
        com.ss.android.newmedia.k.d();
    }

    public void aE() {
    }

    protected void aI() {
        if (this.mUnifyApiUserAgent != 0) {
            NetworkUtils.setUserAgent(this.userAgent());
        }
    }

    public Class getBrowserActivityClass() {
        return null;
    }

    public static MediaAppData provide() {
        if (MediaAppData.instance == null) {
            Object obj = ComponentsManifest.findComponent(MediaAppDataProvider.class);
            if (obj == null) {
                throw new IllegalStateException("MediaAppData not init");
            } else {
                MediaAppData.instance = ((MediaAppDataProvider) obj).provide();
            }
        }

        return MediaAppData.instance;
    }

    public final AppContext getAppContext() {
        if (this.appContext == null) {
            Logger.e("AppData", "appContxt not init");
            throw new IllegalStateException("appContxt not init");
        }

        return this.appContext;
    }

    public final Activity aO() {
        Activity v0_1;
        if (this.cF != null) {
            v0_1 = (Activity) this.cF.get();
        } else {
            v0_1 = null;
        }

        return v0_1;
    }

    public final List aP() {
        int v2_1;
        List v0 = null;
        if (android.support.design.a.isTextEmpty(this.mAdTrackUrlList)) {
            return null;
        }

        ArrayList v1 = new ArrayList();
        try {
            JSONArray v3 = new JSONArray(this.mAdTrackUrlList);
            int v4 = v3.length();
            v2_1 = 0;
            while (true) {
                label_12:
                if (v2_1 >= v4) {
                    break;
                }

                if ((v3.opt(v2_1) instanceof String)) {
                    ((List) v1).add(v3.optString(v2_1));
                }

                ++v2_1;
                continue;
            }
        } catch (Exception v2) {
            v2.printStackTrace();
        }

        this.mAdTrackUrlList = null;
        ArrayList v0_1 = v1;
        label_4:
        return ((List) v0_1);
    }

    public final boolean forceNoHwAcceleration() {
        return this.mForceNoHwAcceleration > 0;
    }

    public final boolean allowInsideDownloadManager() {
        synchronized (this.d) {
            return this.mAllowInsideDownloadManager > 0;
        }
    }

    public final boolean isTaoBaoSdkEnable() {
        return this.mTaoBaoSdkDisable == 0;
    }

    public final boolean videoDiagnosis() {
        return this.mVideoDiagnosisFlag == 1;
    }

    public String ac() {
        return "";
    }

    public String userAgent() {
        return System.getProperty("http.agent");
    }

    public final void onAppStartMonitor() {
        int v0 = this.dh ? this.lastVersionCode : this.mContext.getSharedPreferences("app_setting", 0).getInt("last_version_code", 0);
        com.bytedance.article.common.a.h.a(v0, this.cD);
    }

    public final void az() {
        this.mWeakHandler.sendEmptyMessage(102);
        long v0 = System.currentTimeMillis();
        try {
            if (this.e) {
                return;
            }

            this.e = true;
            if (!TextUtils.isEmpty(AbsApplication.getApplication().getSharedPreferences(com.ss.android.f.a.a.a(), 0).getString("app_track", ""))) {
//                goto label_35;
            } else {
                String v2_1 = FileUtils.d(this.mContext.getPackageCodePath());
                if (!TextUtils.isEmpty(((CharSequence) v2_1))) {
                    AppLog.a(new JSONObject(v2_1));
                }

                if (!Logger.debug()) {
//                goto label_35;
                } else {
                    Logger.d("MediaAppData", "onConfigUpdate: appTrack = " + v2_1);
                }
            }
        } catch (Throwable v2) {
        }

        label_35:
        v0 = System.currentTimeMillis() - v0;
        String v0_1 = "time : " + v0;
        Logger.d("MediaAppData", v0_1);
    }

    public static synchronized void b(Context context, boolean arg7) {
        PushSettingManager pushSettingManager;
        int v2 = arg7 ? 1 : 0;
        if (MediaAppData.allowNetwork == v2) {
            return;
        }

        MediaAppData.allowNetwork = v2;
        SharedPreferences.Editor editor = context.getSharedPreferences("app_setting", 0).edit();
        editor.putInt("allow_network", MediaAppData.allowNetwork);
        SharedPreferenceCompat.commit(editor);
        pushSettingManager = PushSettingManager.getInstance();
        boolean isAllowNetwork = MediaAppData.allowNetwork > 0;
        pushSettingManager.notifyAllowNetwork(context, isAllowNetwork);
    }

    public final SharedPreferences getAppSettingSp() {
        if (this.mAppSettingSp == null) {
            this.mAppSettingSp = AbsApplication.getApplication().getSharedPreferences("app_setting", 0);
        }

        return this.mAppSettingSp;
    }

    public void b(Context context) {
        if (MediaAppData.o(context)) {
            if (this.cK) {
                this.c(context);
            } else {
                this.a(context);
                this.c(context);
                com.ss.android.newmedia.k.c();
                this.cK = true;
            }
        }
    }

    public final void b(f arg2) {
        SSDBHelper v0 = this.getDBHelper();
        if (v0 != null) {
            v0.b(arg2);
        }
    }

    public final void b(JSONObject arg4) {
        this.mWeakHandler.sendMessage(Message.obtain(this.mWeakHandler, 108, arg4));
    }

    public void b(boolean arg4) {
        Object v0 = com.bytedance.frameworks.b.a.a.b(com.ss.android.bb.class);
        if (v0 != null) {
            ((com.ss.android.bb) v0).a(arg4);
        }

        if ((arg4) || !this.cR.isEmpty()) {
            if ((arg4) || (this.cR.contains("night_mode"))) {
                com.ss.android.j.b.isNightModeToggled();
                this.a("night_mode", 0);
            }

            if (!arg4 && !this.cR.contains("repost_favor")) {
                return;
            }

            String v2 = "repost_favor";
            int v0_1 = this.mShareWhenFavor ? 1 : 0;
            this.a(v2, v0_1);
        }
    }

    public SSDBHelper getDBHelper() {
        return null;
    }

    public void c(Context context) {
        if ((context instanceof Activity)) {
            AppLog.e(context);
            int lastVersionCode = this.appContext.getVersionCode();
            if (lastVersionCode != this.lastVersionCode) {
                SharedPreferences.Editor editor = this.mContext.getSharedPreferences("app_setting", 0).edit();
                editor.putInt("last_version_code", lastVersionCode);
                SharedPreferenceCompat.commit(editor);
            }
        }
    }

    public void onActivityResumed(Activity activity) {
    }

    public final void c(Context context, boolean shareWhenFavor) {
        this.cR.add("repost_favor");
        this.mShareWhenFavor = shareWhenFavor;
        SharedPreferences.Editor editor = context.getSharedPreferences("app_setting", 0).edit();
        editor.putBoolean("share_when_favor", this.mShareWhenFavor);
        SharedPreferenceCompat.commit(editor);
    }

    public final void c(boolean sendUserSettingsResult) {
        SharedPreferences.Editor editor = this.mContext.getSharedPreferences("app_setting", 0).edit();
        editor.putBoolean("send_user_settings_result", sendUserSettingsResult);
        SharedPreferenceCompat.commit(editor);
    }

    public final void d() {
        Iterator v1 = this.cT.iterator();
        while (v1.hasNext()) {
            Object v0 = v1.next();
            if (v0 == null) {
                continue;
            }

            ((h$b) v0).e();
        }
    }

    public void onActivityPaused(Activity activity) {
        if (((activity instanceof AbsActivity)) && (((AbsActivity) activity).enableMobClick())) {
            MobClickCombiner.onPause(((Context) activity));
        }

        long v4 = System.currentTimeMillis();
        Object v0 = null;
        Object v2 = this.cF != null ? this.cF.get() : v0;
        long v0_1 = 5;
        if (v2 != null && (((Activity) v2)) == activity) {
            v0_1 = (v4 - this.cI) / 1000;
            if (v0_1 <= 0) {
                v0_1 = 2;
            }
        }

        this.cG += v0_1;
        this.cH = v0_1 + this.cH;
        this.cJ = v4;
        if (this.cF != null) {
            this.cF.clear();
        }

        if (this.cL) {
            this.g(((Context) activity));
            this.cL = false;
        }

        if (!this.a(activity)) {
            this.f(activity);
        }
    }

    public final void d(boolean arg5) {
        if (!this.i) {
            this.h = new JSONObject();
            this.b(arg5);
            this.cR.clear();
            if (this.h.length() != 0) {
                this.c(false);
                String v0 = this.h.toString();
                if (NetworkUtils.isNetworkAvailable(this.mContext)) {
                    this.i = true;
                    new com.ss.android.newmedia.j.b(this.mContext, this.mWeakHandler, v0).start();
                }
            }
        }
    }

    public String e() {
        return null;
    }

    protected boolean e(Activity arg2) {
        return true;
    }

    private void f() {
        if (!android.support.design.a.isTextEmpty(this.mDownloadWhiteListFileStr)) {
            try {
                JSONArray v0_1 = new JSONArray(this.mDownloadWhiteListFileStr);
                if (v0_1.length() <= 0) {
                    return;
                }

                this.n.clear();
                MediaAppData.parseJA(v0_1, this.n);
            } catch (Exception v0) {
            }
        }
    }

    public void f(Activity arg2) {
        SsRedbadgeManager.inst(((Context) arg2)).onPause();
    }

    protected void f(Context arg2) {
        this.a(this.getAppSettingSp());
        this.aI();
    }

    public void g(Context arg3) {
        this.cL = false;
        SharedPreferences.Editor v0 = arg3.getSharedPreferences("app_setting", 0).edit();
        this.a(v0);
        SharedPreferenceCompat.commit(v0);
    }

    public final void g(Activity arg7) {
        if (!android.support.design.a.isTextEmpty(AppLog.deviceId())) {
            long v0 = System.currentTimeMillis();
            if (arg7 != null && v0 - this.j > 1200000 && (NetworkUtils.isNetworkAvailable(((Context) arg7))) && v0 - this.k > 120000) {
                this.k = v0;
                Context v2 = this.mContext;
                WeakHandler v3 = this.mWeakHandler;
                boolean v0_1 = !this.mDefaultSettingLoaded ? true : false;
                new com.ss.android.newmedia.j.c(v2, ((Handler) v3), v0_1).start();
            }
        }
    }

    public void handleMsg(Message message) {
        int v0_5;
        Object v0_3;
        boolean v2 = false;
        switch (message.what) {
            case 102: {
                if (!android.support.design.a.isTextEmpty(AppLog.k()) && !android.support.design.a.isTextEmpty(AppLog.deviceId())) {
                    com.bytedance.common.utility.b.a.a(new com.ss.android.newmedia.ii(this), new Void[0]);
                    Activity v0_1 = this.aO();
                    if (v0_1 != null) {
                        this.g(v0_1);
                    }
                }

                Bundle v0_2 = new Bundle();
                v0_2.putInt("year", com.facebook.a.a.c.a(AbsApplication.getApplication()));
                android.support.design.a.onEvent("device_year", v0_2);
                v0_3 = com.bytedance.frameworks.b.a.a.b(com.ss.android.bb.class);
                if (v0_3 == null) {
                    return;
                }

                ((com.ss.android.bb) v0_3).b();
                break;
            }
            case 106: {
                this.m = false;
                if (!(message.obj instanceof String)) {
                    return;
                }

                this.mDownloadWhiteListFileStr = (String) message.obj;
                this.f();
                this.mDownloadWhiteListFileTime = System.currentTimeMillis();
                SharedPreferences.Editor v0_4 = this.mContext.getSharedPreferences("app_setting", 0).edit();
                v0_4.putString("download_white_list_file_str", this.mDownloadWhiteListFileStr);
                v0_4.putLong("download_white_list_file_time", this.mDownloadWhiteListFileTime);
                v0_4.commit();
                break;
            }
            case 107: {
                this.m = false;
                break;
            }
            case 10005: {
                this.c(true);
                long v0 = System.currentTimeMillis();
                SharedPreferences.Editor v3 = this.mContext.getSharedPreferences("app_setting", 0).edit();
                v3.putLong("last_send_user_settings_time", v0);
                SharedPreferenceCompat.commit(v3);
                this.i = false;
                break;
            }
            case 10006: {
                this.i = false;
                break;
            }
            case 10008: {
                if ((message.obj instanceof com.ss.android.newmedia.j.c.c$a)) {
                    this.a = (com.ss.android.newmedia.j.c.c$a) message.obj;
                    com.ss.android.newmedia.j.c.c$a v3_1 = this.a;
                    this.j = System.currentTimeMillis();
                    if (!v3_1.a || (this.mDefaultSettingLoaded)) {
                        v0_5 = 0;
                    } else {
                        this.mDefaultSettingLoaded = true;
                        v0_5 = 1;
                        v2 = true;
                    }

                    if (v3_1.b != null && (this.a(v3_1.b, v2))) {
                        v0_5 = 1;
                    }

                    if (v3_1.c != null && (this.a(v3_1.c))) {
                        v0_5 = 1;
                    }

                    if (v0_5 != 0) {
                        this.g(this.mContext);
                    }

                    this.aI();
                    SubscriptionRouter.c(new h$a());
                }

                v0_3 = com.bytedance.frameworks.b.a.a.b(com.ss.android.bb.class);
                if (v0_3 == null) {
                    return;
                }

                if (Logger.debug()) {
                    Logger.d("ObserverManager", "onSettingisOk MediaAppData");
                }

                ((com.ss.android.bb) v0_3).c();
                break;
            }
            case 10010: {
                if (!(message.obj instanceof IdCache.Id)) {
                    return;
                }

                int v2_1 = message.arg1;
                v0_3 = message.obj;
                if (Logger.debug()) {
                    Logger.d("PushService", "save MessageId = " + ((IdCache.Id) v0_3).toString());
                }

                if (v2_1 != 1) {
                    return;
                }

                this.mNotifyMessage.addId(((IdCache.Id) v0_3));
                this.g(this.mContext);
                break;
            }
        }
    }

    public final boolean i(String arg4) {
        boolean v0;
        if (arg4 == null) {
            v0 = false;
        } else if (TTUtils.isValidUrl(arg4)) {
            v0 = false;
        } else {
            Iterator v2 = this.l.iterator();
            do {
                if (v2.hasNext()) {
                    if (!arg4.startsWith((String) v2.next())) {
                        continue;
                    }

                    return true;
                } else {
                    return false;
                }
            } while (true);
        }

        return v0;
    }

    public final boolean j(String arg4) {
        boolean v0;
        if (this.n == null || (this.n.isEmpty())) {
            v0 = true;
        } else if (android.support.design.a.isTextEmpty(arg4)) {
            v0 = true;
        } else {
            Iterator v2 = this.n.iterator();
            do {
                if (v2.hasNext()) {
                    if (arg4.indexOf((String) v2.next()) < 0) {
                        continue;
                    }

                    return true;
                } else {
                    return false;
                }
            }
            while (true);
        }

        return v0;
    }

    public static List k(String arg6) {
        int v0 = 0;
        ArrayList v1 = new ArrayList();
        try {
            JSONArray v2 = new JSONArray(arg6);
            while (true) {
                label_5:
                if (v0 >= v2.length()) {
                    return ((List) v1);
                }

                JSONArray v3 = v2.getJSONArray(v0);
                if (v3.length() == 2) {
                    ((List) v1).add(Pair.create(Pattern.compile(v3.getString(0)), v3.getString(1)));
                }

                ++v0;
                continue;
            }
        } catch (Exception v0_1) {
            v0_1.printStackTrace();
        }
        return ((List) v1);
    }

    public static SharedPreferences getAppSettingSp(Context context) {
        return context.getSharedPreferences("app_setting", 0);
    }

    public static SharedPreferences getSharedPreference(Context context) {
        return context.getSharedPreferences("app_setting", 0);
    }

    public static synchronized boolean o(Context context) {
        try {
            if (MediaAppData.allowNetwork == -1) {
                PushSettingManager pushSettingManager;
                boolean isAllowNetwork = false;
                if (MediaAppData.f) {
                    MediaAppData.allowNetwork = context.getSharedPreferences("app_setting", 0)
                            .getInt("allow_network", 0);
                    pushSettingManager = PushSettingManager.getInstance();
                    if (MediaAppData.allowNetwork > 0) {
                        isAllowNetwork = true;
                    } else {
                        isAllowNetwork = false;
                    }
                    pushSettingManager.notifyAllowNetwork(context, isAllowNetwork);
                } else {
                    MediaAppData.allowNetwork = 1;
                    pushSettingManager = PushSettingManager.getInstance();
                    if (MediaAppData.allowNetwork > 0) {
                        isAllowNetwork = true;
                    } else {
                        isAllowNetwork = false;
                    }
                    pushSettingManager.notifyAllowNetwork(context, isAllowNetwork);
                }

                int v2_1;
                if (!android.support.design.a.isTextEmpty(CustomChannelHandler.getInstance(context).mAppChannel)) {
                    v2_1 = 1;
                } else {
                    v2_1 = 0;
                }

                if (v2_1 == 0) {
                    CustomChannelHandler.getInstance(context).loadAppInstallJsonFromLocal();
                    CustomChannelHandler customChannelHandler = CustomChannelHandler.getInstance(context);
                    AppContext appContext = MediaAppData.provide().getAppContext();
                    if (appContext != null) {
                        customChannelHandler.mAppChannel = appContext.getChannel();
                        customChannelHandler.saveAppInstallJson();
                    }
                }
            }
            if (MediaAppData.allowNetwork <= 0) {
                return false;
            }
            return true;
        } catch (Exception v0_1) {
            return true;
        }
    }
}

